CREATE TABLE [dbo].[TDREPO_TITU]
(
[CO_EMPR] [dbo].[TD_VC_002] NOT NULL,
[NU_ANNO] [dbo].[TD_IN_004_ANNO] NOT NULL CONSTRAINT [DF__TDREPO_TI__NU_AN__1AD3FDA4] DEFAULT (datepart(year,getdate())),
[CO_REPO] [dbo].[TD_VC_003] NOT NULL,
[CO_TITU] [dbo].[TD_VC_003] NOT NULL,
[DE_TITU] [dbo].[TD_VC_100] NULL,
[CO_USUA_CREA] [dbo].[TD_VC_008_USUA] NOT NULL,
[FE_USUA_CREA] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TDREPO_TI__FE_US__1CBC4616] DEFAULT (getdate()),
[CO_USUA_MODI] [dbo].[TD_VC_008_USUA] NOT NULL,
[FE_USUA_MODI] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TDREPO_TI__FE_US__1DB06A4F] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TDREPO_TITU] ADD CONSTRAINT [CK__TDREPO_TI__NU_AN__1BC821DD] CHECK (([NU_ANNO]>=(0)))
GO
ALTER TABLE [dbo].[TDREPO_TITU] ADD CONSTRAINT [XPKTDREPO_TITU] PRIMARY KEY CLUSTERED  ([CO_EMPR], [NU_ANNO], [CO_REPO], [CO_TITU]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TDREPO_TITU] ADD CONSTRAINT [FK1_TCREPO_A_TDREPO_TITU] FOREIGN KEY ([CO_EMPR], [NU_ANNO], [CO_REPO]) REFERENCES [dbo].[TCREPO] ([CO_EMPR], [NU_ANNO], [CO_REPO])
GO
